package org.jeecg.modules.util;

import java.util.ArrayList;
import java.util.List;

public class ListUtils {
    private ListUtils() {

    }

    public  static List<String> syn2Add(List<String> srcList, List<String> dstList){
        List<String> result = new ArrayList<>();

        for (String ele : dstList) {
            if (!srcList.contains(ele)) {
                result.add(ele);
            }
        }
        return result;
    }

    public  static List<String>  syn2Delete(List<String> srcList, List<String> dstList){
        List<String> result = new ArrayList<>();

        for (String ele : srcList) {
            if (!dstList.contains(ele)) {
                result.add(ele);
            }
        }
        return result;
    }

    public static String list2Str(List<String> sl) {
        String result ="";
        int i=0;
        for (String s : sl) {
            result +=s;
            i++;
            if (i < sl.size()){
                result +=",";
            }
        }

        return result;
    }
}